using System;
using System.IO;
using System.Text;
using System.Windows;

namespace Qplus.Commands
{

    /**
     *
     *
     */
    public class GetResCommand : AbsHeaderHttpCommand , HttpInputStreamProcessor{

	    const String COMMAND = "GetRes";
	
	    const String FILENAME_HEAD = "filename";
	
	    String filename;
	    /**
	     * @param uid
	     * @param UKEY
	     */
	    public GetResCommand(String uid, String UKEY)
            : base(COMMAND, uid, UKEY)
        {
		    
	    }
	
	    /**
	     * @param uid
	     * @param UKEY
	     */
	    public GetResCommand(long uid, byte[] UKEY, String filePath)
            : base(COMMAND, uid.GetType().ToString(), Encoding.UTF8.GetString(UKEY, 0, 32))
        {
		    this.filename = filePath;
	    }
	
	    public void set(long resid){
		    setResID(resid);
	    }

	    private void setResID(long resID){
		    addParams("ResID", resID);
	    }
	    
	    public override Boolean processInputStream(Stream responseStream) {
		    //TODO
            return true;
	    }
	
	    
	  //  public override Boolean processHeader(Header[] heads) {
	//	    return true;
	 //   }

	    
	    public override void onSuccess(int code) {
	    }


        public override void onFailed(int code)
        {
	    }

	  //  public void onGetRes(File f){
	  //  }
	
	    public HttpTask execute(String url) {
		    return base.execute(url, this);
	    }
    }
}
